#include <bits/stdc++.h>

using namespace std;
const int M=10002;
int P[M]={0};
int main_69()
{
    int n;
    scanf("%d",&n);
    int A[n+2]={0};
    A[0]=A[n+1]={0};
    for (int i=1;i<=n ;++i )
    {
        scanf("%d",&A[i]);
        if (A[i]>A[i-1])
        {
            P[A[i]]++;
            P[A[i-1]]--;
        }
    }
    int ans=0,t=0;
    for (int i=M;i>=0 ;--i )
    {
        t+=P[i];
        ans=max(t,ans);
    }
    printf("%d",ans);
    return 0;
}
